//
//  HZBlockCollectionViewCell.m
//  HZTC_Stock
//
//  Created by MayerF on 17/3/13.
//  Copyright © 2017年 MayerF. All rights reserved.
//

#import "HZBlockCollectionViewCell.h"

@interface HZBlockCollectionViewCell()
@property (nonatomic, strong)UIView *pBackView;
@end

@implementation HZBlockCollectionViewCell

#pragma mark -
#pragma mark 生命周期
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self p_commonInit];
        self.backgroundColor = kMYHexToRGB(0xe9e9e9, 1);
    }
    return self;
}

- (void)p_commonInit
{
    _pBackView = [UIView new];
    self.pName = [UILabel new];
    self.pNum = [UILabel new];
    
    _pBackView.backgroundColor = [UIColor whiteColor];
    _pName.backgroundColor = [UIColor whiteColor];
    _pNum.backgroundColor = [UIColor whiteColor];
    _pName.textAlignment = _pNum.textAlignment = NSTextAlignmentCenter;
    _pName.font = [UIFont systemFontOfSize:15];
    _pNum.font = [UIFont boldSystemFontOfSize:20];
    _pName.adjustsFontSizeToFitWidth = YES;
    
    [self addSubview:_pName];
    [self addSubview:_pNum];
    
    [self p_initConstraints];
}

#pragma mark -
#pragma mark private
- (void)p_initConstraints
{
    [_pName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(0.5);
        make.left.mas_equalTo(self).offset(0.5);
        make.right.mas_equalTo(self).offset(-0.5);
        make.bottom.mas_equalTo(_pNum.mas_top);
    }];
    [_pNum mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_pName);
        make.right.mas_equalTo(_pName);
        make.bottom.mas_equalTo(self).offset(-0.5);
        make.height.mas_equalTo(_pName);
    }];
}

@end
